package com.wf.demo.sys.controller;

import com.wf.demo.info.util.Page4Navigator;
import com.wf.demo.info.util.Result;
import com.wf.demo.sys.pojo.SysLogEntity;

import com.wf.demo.sys.pojo.UserTime;
import com.wf.demo.sys.service.UserLoginTimeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Auther: wf
 * @Date: 2020/6/20 17:22
 * @Description:
 */
@Slf4j
@RestController
public class UserLoginTimeController {
    @Autowired
    UserLoginTimeService userLoginTimeService;

    @GetMapping("/userLoginTimeRecord")
    @RequiresPermissions("sys:userLoginTimeRecord")
    public Page4Navigator<UserTime> list(@RequestParam(value = "start",defaultValue = "0")int start,
                                             @RequestParam(value = "size",defaultValue = "10")int size) throws Exception{
        start = start<0? 0:start;
        Page4Navigator<UserTime> page  = userLoginTimeService.list(start,size,5);
        return page;
    }

    //权限
    @DeleteMapping("/userLoginTimeRecord/{id}")
    @RequiresPermissions("sys:userLoginTimeRecord")
    public Object  delete(@PathVariable("id")long id ){
        userLoginTimeService.delete(id);
        return  Result.error(200,"删除成功");
    }
}
